//
//  AppTool.m
//  DaHaiDouBan
//
//  Created by dllo on 15/10/29.
//  Copyright © 2015年 Wang Dahai. All rights reserved.
//

#import "AppTool.h"
#import "AFNetworking.h"
@implementation AppTool

+(void)getDataWithAFNFromURL:(NSString *)url andBlock:(AppToolsGetDataBlock)activityBlock
{
    //请求管理者 所有的网络请求,均有manager发起
    AFHTTPRequestOperationManager* manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html",nil];
    [manager GET:url parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        activityBlock(responseObject);
        NSLog(@"请求成功");
        
       } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
       // activityBlock(error);
        NSLog(@"请求失败");
        
        
        
    }];
    
    
}


@end
